package com.ctshk.sapp.finance.controller;


import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.finance.dto.bill.BillRejectDetailDTO;
import com.ctshk.rpc.finance.req.bill.BillIdReq;
import com.ctshk.rpc.finance.req.bill.BillRejectAddReq;
import com.ctshk.rpc.finance.req.bill.BillRejectDetailReq;
import com.ctshk.rpc.finance.service.IFinanceBillRejectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;

/**
 * <p>
 * 认款驳回记录 前端控制器
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-04-19
 */
@RestController
@Api(value = "认款驳回", tags = "认款驳回")
@RequestMapping("/finance-bill-reject")
public class FinanceBillRejectController extends BaseController {

    @DubboReference
    private IFinanceBillRejectService billRejectService;


    @ApiOperation(value = "驳回信息", notes = "认款管理-驳回信息（叶冠峰）")
    @OperationLogAnnotation(operModul = OperationLogModel.FINANCE, operType = OperationLogType.QUERY, operTitle = "认款管理-驳回信息", operDesc = "认款管理-驳回信息")
    @PostMapping("/detail")
    public Result<BillRejectDetailDTO> detail(@RequestBody @Valid BillRejectDetailReq req){
        return billRejectService.detail(req);
    }

    @ApiOperation(value = "驳回", notes = "认款管理-驳回（叶冠峰）")
    @OperationLogAnnotation(operModul = OperationLogModel.FINANCE, operType = OperationLogType.ADD, operTitle = "认款管理-驳回", operDesc = "认款管理-驳回")
    @PostMapping("/add")
    public Result add(@RequestBody @Valid BillRejectAddReq req){
        req.setUser(getCurrentUser(getRequest()));
        return billRejectService.add(req);
    }

}
